package com.gdcvi.scan;

/**
 * PalyFactory：创建手工厂
 */
public class PalyFactory {

    public Hand createHand(int sum) {
        Hand hand = null;
        switch (sum) {
            case Stone.编号:
                hand = new Stone();
                hand.getResult().put(Shears.class.getName(), hand.WINNER);
                hand.getResult().put(Cloth.class.getName(), hand.LOSER);
                hand.getResult().put(Stone.class.getName(), hand.EQUALS);
                hand.getResult().put(Fork.class.getName(), hand.LOSER);
                return hand;
            case Shears.编号:
                hand = new Shears();
                hand.getResult().put(Shears.class.getName(), hand.EQUALS);
                hand.getResult().put(Cloth.class.getName(), hand.WINNER);
                hand.getResult().put(Stone.class.getName(), hand.LOSER);
                hand.getResult().put(Fork.class.getName(), hand.LOSER);
                return hand;
            case Cloth.编号:
                hand = new Cloth();
                hand.getResult().put(Shears.class.getName(), hand.LOSER);
                hand.getResult().put(Cloth.class.getName(), hand.EQUALS);
                hand.getResult().put(Stone.class.getName(), hand.WINNER);
                hand.getResult().put(Fork.class.getName(), hand.EQUALS);
                return hand;
            case Fork.编号:
                hand = new Fork();
                hand.getResult().put(Stone.class.getName(), hand.WINNER);
                hand.getResult().put(Shears.class.getName(), hand.LOSER);
                hand.getResult().put(Cloth.class.getName(), hand.EQUALS);
                hand.getResult().put(Fork.class.getName(), hand.EQUALS);
                return hand;
        }
        throw new RuntimeException("编号不对");
    }
}
